package com.lb.shopguide.adapter;

import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lb.shopguide.R;
import com.lb.shopguide.constants.AppConstant;
import com.lb.shopguide.entity.PickCashRecordBean;
import com.lb.shopguide.entity.PointConfigBean;
import com.netease.nim.uikit.common.adapter.TViewHolder;
import com.yqritc.recyclerviewflexibledivider.FlexibleDividerDecoration;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

import java.util.List;

/**
 * Created by kang on 2018/1/8.
 */

public class AdapterPickCash extends BaseQuickAdapter<PickCashRecordBean, BaseViewHolder> implements HorizontalDividerItemDecoration.MarginProvider, FlexibleDividerDecoration.PaintProvider {
    public AdapterPickCash(int layoutResId, @Nullable List<PickCashRecordBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PickCashRecordBean item) {
        View view = helper.itemView;
        TextView tvPickMoney = view.findViewById(R.id.tv_pick_money);
        TextView tvShouxuMoney = view.findViewById(R.id.tv_shouxu_money);
        TextView tvStatus = view.findViewById(R.id.tv_status);
        TextView tvPickTime = view.findViewById(R.id.tv_pick_time);
        TextView tvPickAccount = view.findViewById(R.id.tv_pick_account);

        tvPickMoney.setText("提现：" + item.getPickCash());
        tvShouxuMoney.setText("手续费：" + item.getPickServiceFee());

        tvPickAccount.setText("提现支付宝账户：" + item.getReceiveAccount());
        tvPickTime.setText(item.getPickTime());
        int blue = Color.rgb(124, 200, 255);
        int red = Color.rgb(245, 110, 87);
        if (item.getPickStatus() == AppConstant.STATUS_PICK_APPLYING) {
            tvStatus.setText("申请中");
            tvStatus.setTextColor(blue);
        } else if (item.getPickStatus() == AppConstant.STATUS_PICK_SUCCESS) {
            tvStatus.setText("提现成功");
            tvStatus.setTextColor(blue);
        } else if (item.getPickStatus() == AppConstant.STATUS_PICK_FAIL) {
            tvStatus.setText("提现失败");
            tvStatus.setTextColor(red);
        }
    }

    @Override
    public Paint dividerPaint(int position, RecyclerView parent) {
        Paint paint = new Paint();
        paint.setColor(mContext.getResources().getColor(R.color.bs_common_line_bg));
        paint.setStrokeWidth(2);
        return paint;
    }

    @Override
    public int dividerLeftMargin(int position, RecyclerView parent) {
        return 150;
    }

    @Override
    public int dividerRightMargin(int position, RecyclerView parent) {
        return 0;
    }
}
